﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using RearLivestock.Common.Dtos;
using RearLivestock.RBAC.Api.hhxApplication.Commands.UserTable;
using RearLivestock.RBAC.Read.Api.hhxApplication.Commands.UserTable;

namespace RearLivestock.RBAC.Read.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class UsersController : ControllerBase
    {
        private readonly IMediator mediator;

        public UsersController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 证件类型列表获取
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> GetIDCards(GetIDCardCommand cmd)
        {
            return await mediator.Send(cmd);
        }

        /// <summary>
        /// 学历列表获取
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> GetStudies(GetStudiesCommand cmd)
        {
            return await mediator.Send(cmd);
        }

        /// <summary>
        /// 单位列表获取
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> GetUnits(GetUnitsCommand cmd)
        {
            return await mediator.Send(cmd);
        }
    }
}
